from mycelery.main import app

from lyapi.libs.ronglian_sms_sdk.sms import send_message
from django.conf import settings
from lyapi.settings import constants

import logging
logger = logging.getLogger('django')


@app.task(name='smsCode')
def sms_codes(phone,sms_code):
    ret2 = send_message(settings.SMS_INFO.get('TID'), phone, (sms_code, constants.SMS_CODE_EXPIRE_TIME // 60))
    if not ret2:
        logger.error('{}手机号短信发送失败'.format(phone))

    return '短信发送成功啦'



